import { h } from 'vue';
import { AdColumn } from '@/components/AdTable';
import { expandAndToString } from '@/utils/common';

export const dictEntryColumns: AdColumn[] = [
  {
    title: '主键',
    dataIndex: 'Id',
    dataType: 'guid',
    width: 250,
    filterable: false,
    sorter: false,
    defaultHidden: true,
    formVisible: true,
    formEditable: false,
  },
  {
    title: '字典编码',
    dataIndex: 'DictId',
    dataType: 'guid',
    width: 150,
    defaultHidden: false,
    formVisible: true,
    formEditable: false,
    formSchema: {
      rules: [
        {
          required: true,
          message: '请先选择 字典编码',
        },
      ],
    },
  },
  {
    title: '编码名称',
    dataIndex: 'CodeName',
    width: 250,
    filterable: true,
    sorter: true,
    dataType: 'string',
    required: true,
  },
  {
    title: '编码值',
    dataIndex: 'CodeValue',
    width: 250,
    filterable: true,
    sorter: true,
    dataType: 'number',
  },
  {
    title: '备注',
    dataIndex: 'Remark',
    width: 100,
    filterable: true,
    dataType: 'text',
    sorter: true,
  },
  {
    title: '排序号',
    dataIndex: 'OrderNo',
    width: 100,
    filterable: true,
    dataType: 'number',
    sorter: true,
  },
  {
    title: '锁定',
    dataIndex: 'IsLocked',
    filterable: true,
    dataType: 'boolean',
    sorter: true,
    width: 180,
    formSchema: {
      colProps: {
        xs: 12, // <576px
        sm: 12, // ≥576px
        md: 12, // ≥768px
        lg: 12, // ≥992px
        xl: 12, // ≥1200px
        xxl: 12,
      },
    },
  },
  {
    title: '创建时间',
    dataIndex: 'CreatedTime',
    dataType: 'datetime',
    sorter: true,
    width: 120,
    formVisible: true,
    formEditable: false,
  },
  {
    title: '更新时间',
    dataIndex: 'UpdatedTime',
    dataType: 'datetime',
    sorter: true,
    width: 120,
    formVisible: true,
    formEditable: false,
  },
];

export interface DictEntryInputDto {
  Id: string;
}

export interface DictEntryOutputDto {
  /** 唯一编号 */
  Id: string;
}
